<template>
  <div id="main">
    <el-form ref="addform" :model="addform" :rules="fromrules">
      <el-form-item label="请求地址" label-width="120px" prop="httpUrl">
        <el-input style="width: 90%" placeholder="" size="mini" v-model="addform.httpUrl "
                  autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="请求类型" label-width="120px" prop="requestType">
        <el-select filterable style="width: 90%" size="mini" v-model="addform.requestType "
                   placeholder="请选择请求类型">
          <el-option
            v-for="item in option1"
            :key="item.value"
            :label="item.value"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="Content-Type" label-width="120px" prop="contentType">
        <el-input style="width: 90%"  placeholder="" size="mini" v-model="addform.contentType "
                  autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="请求参数" label-width="120px">
        <el-input style="width: 90%" type="textarea" placeholder="" size="mini" v-model="addform.httpBody "
                  autocomplete="off"></el-input>
      </el-form-item>

      <el-form-item label="断言JSON Path" label-width="120px">
        <el-input style="width: 90%" placeholder="" size="mini" v-model="addform.assertPath"
                  autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="断言Value" label-width="120px">
        <el-input style="width: 90%" placeholder="" size="mini" v-model="addform.assertValue"
                  autocomplete="off"></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { codemirror } from "vue-codemirror";
import "codemirror/lib/codemirror.css"; // 基本样式
import "codemirror/theme/ambiance.css"; // 主题1 这里引入的是主题样式，根据设置的theme的主题引入，一定要引入！！
import "codemirror/theme/base16-light.css"; // 主题2
import "codemirror/theme/cobalt.css"; // 主题3
import "codemirror/mode/sql/sql.js";
import Crontab from "@/views/taskscheduler/components/crontab/index.vue";
//禁止缩放
export default {
  // components: {
  //   Crontab,
  //   codemirror
  // },
  data() {
    return {
      option1: [
        {
          value: "post"
        },
        {
          value: "get"
        }
      ],
      addform: {
        httpUrl: "",
        requestType: "",
        httpBody: "{}",
        assertPath: "",
        assertValue: "",
        contentType:'application/json;charset=UTF-8'
      },
      fromrules: {
        httpUrl: { required: true, message: "请输入", trigger: "blur" },
        requestType: { required: true, message: "请选择", trigger: "change" },
        contentType:{required: true, message: "请输入", trigger: "blur"}
      }
    };
  },
  methods: {
    getdata() {
      // console.log("data", this.form);
    },
    invertData(data) {
      this.$refs.addform.resetFields();
      if(data){
        this.addform = data;
      }
    }
  },
  mounted() {
  }
};
</script>
<style lang="scss" scoped>
::v-deep.code-mirror {
  .CodeMirror-line {
    font-size: 16px;
  }

  .CodeMirror-linenumber {
    font-size: 16px;
  }

  .cm-s-cobalt.CodeMirror {
    background-color: black;
  }
}
</style>
